package main

import "fmt"

func main() {
	//const  常量
	const pi = 3.1415926 //定义就需要赋值，后续不能改变
	fmt.Println(pi)

	const ( //同时声明多个常量
		A = "A"
		B = "B"
	)
	fmt.Println(A, B)

	const ( //只赋值了第一个，下面的就全是a
		a = "a"
		b
		c = "c"
		d
		e
	)
	fmt.Println(a, b, c, d, e) // "a a c c c"

	// iota 计数器，搭配const使用
	// 每次const出现，会让iota自自增长加一
	const m = iota // m=0
	const (
		n = iota // n=0
		o        // o=1
	)
	fmt.Println(n, o)

	const ( // _ 跳过
		a1 = iota
		_  ///跳过了1
		a3
		a4
	)
	fmt.Println(a1, a3, a4) // 0,203

	//iota 声明中间插队
	const (
		b1 = iota
		b2 = 100
		b3 = iota
		b4
	)
	fmt.Println(b1, b2, b3, b4) // 0,100,2,3

	const (
		c1, c2 = iota + 1, iota + 2 //1,2
		c3, c4                      //2,3
		c5, c6                      //3,4
	)
	fmt.Println(c1, c2)
	fmt.Println(c3, c4)
	fmt.Println(c5, c6)

	var age = 18
	var AGE = 18
	fmt.Println(age, AGE) // 18 18  go严格区分大小写
}
